/*
 * @title: 授权工具
 * @author: andy.ten@tom.com & xukaixing@hotmail.com
 * @Date: 2022-03-21 16:53:54
 * @LastEditors: andy.ten@tom.com
 * @LastEditTime: 2022-06-05 17:22:09
 * @version: 1.0.4
 * @copyright: copyright (c) 2022 andyten
 *  node: you can not copy and/or use and/or modify this program free,
 *  please reserve the segment above.Please mail me if you have any question.
 */
// import Cookies from 'js-cookie';
import Settings from '@/settings';
import { mySStorage, myLStorage } from './index';
export const clearSStorage = () => mySStorage.clear();
const tokenKey = Settings.token;
export const getToken = () => mySStorage.get(tokenKey);
export const setToken = (token) => mySStorage.set(tokenKey, token);
export const removeToken = () => mySStorage.remove(tokenKey);

const loginAccountKey = Settings.loginAccount;
export const getLoginAccount = () => mySStorage.get(loginAccountKey);
export const setLoginAccount = (loginAccount) => mySStorage.set(loginAccountKey, loginAccount);

const loginUserIdKey = Settings.loginUserId;
export const getLoginUserId = () => mySStorage.get(loginUserIdKey);
export const setLoginUserId = (loginUserId) => mySStorage.set(loginUserIdKey, loginUserId);

const loginUuidKey = Settings.loginUuid;
export const getLoginUuid = () => mySStorage.get(loginUuidKey);
export const setLoginUuid = (loginUuid) => mySStorage.set(loginUuidKey, loginUuid);

const languageKey = Settings.language;
export const getLanguage = () => myLStorage.get(languageKey) || 'zh';
export const setLanguage = (language) => myLStorage.set(languageKey, language);

const userInfoKey = Settings.userInfo;
export const getUserInfo = () => mySStorage.get(userInfoKey);
export const setUserInfo = (userInfo) => mySStorage.set(userInfoKey, userInfo);

const refreshTokenKey = Settings.refreshToken;
export const getRefreshToken = () => myLStorage.get(refreshTokenKey);
export const setRefreshToken = (token) => myLStorage.set(refreshTokenKey, token);

const dictKey = Settings.dict;
export const getDict = () => myLStorage.get(dictKey);
export const setDict = (dict) => myLStorage.set(dictKey, dict);

const navMenusKey = Settings.navMenus;
export const getNavMenus = () => mySStorage.get(navMenusKey);
export const setNavMenus = (navMenus) => mySStorage.set(navMenusKey, navMenus);

const isLoadDictKey = Settings.isLoadDict;
export const getIsLoadDict = () => myLStorage.get(isLoadDictKey);
export const setIsLoadDict = (isLoadDict) => myLStorage.set(isLoadDictKey, isLoadDict);

const rtflagKey = Settings.rtflag;
export const getRtflag = () => myLStorage.get(rtflagKey) ? 1 : 0;
export const setRtflag = (rtflag) => myLStorage.set(rtflagKey, rtflag);
